home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_sol_horusdoors.cog < prev    next >
Text File  |  1999-11-15  |  7KB  |  260 lines

  1. # Jones 3D Cog Script
  2. #
  3. # SOL_HorusDoors.cog
  4. #
  5. # [TRM]
  6. #
  7. # (C) 1999 LucasArts Entertainment Co. All Rights Reserved
  8. # ========================================================================================
  9.  
  10. symbols
  11.  
  12.     message     startup
  13.     message     entered
  14.     message     activated
  15.     message     blocked
  16.  
  17.     thing       player      local
  18.     thing       doorL                              
  19.     thing       doorR
  20.     thing       horus_Cam1
  21.    
  22.     sector      doorSector
  23.  
  24.     surface     open
  25.     surface     close
  26.     surface     inside
  27.     surface     openInside
  28.     
  29.     sound       sndOpen=sol_cardoor_open_c.wav      local
  30.     sound       sndClose=sol_cardoor_close_c.wav    local
  31.     
  32.     # ** voice lines **
  33.     sound       in_Line0=Pr15j02.wav        local   # The fire door only opens...
  34.     sound       in_Line1=Inxj096.wav        local   # I can't open it.
  35.     sound        fireSafety=pr15j01.wav        local   # Horner must have been worried...
  36.     
  37.     cog         cog_ChaseLower
  38.     
  39.     int         doorsOpen=0     local
  40.     int         doorsMoving=0   local
  41.     int         sender            local
  42.     int         car             local
  43.     int         newComment      local
  44.     int         oldComment      local
  45.     int         playing=0       local
  46.     int         count=0         local
  47.     int         done=0          local
  48.     int         in_Cut=0        local
  49.     
  50.     # ** subroutines **
  51.     flex        doorLine        local
  52.     flex        openDoors       local
  53.     flex        closeDoors      local
  54.         
  55. end
  56.  
  57. # ========================================================================================
  58. code
  59.  
  60. startup:
  61.  
  62.     SectorAdjoins(doorSector, 0);
  63.     SetThingLight(doorL, '0.3 0.3 0.35', 0.001, 2.0);
  64.     SetThingLight(doorR, '0.3 0.3 0.35', 0.001, 2.0);
  65.     return;
  66.         
  67. # ========================================================================================
  68.  
  69. entered:
  70.         
  71.     player = GetLocalPlayerThing();
  72.     sender = GetSenderRef();
  73.     car = GetSourceRef();
  74.  
  75.     if((BitTest(GetPhysicsFlags(car), 0x01000000)) && (doorsMoving == 0))
  76.     {
  77.         if((sender == open) && (doorsOpen == 0))
  78.         {
  79.             in_Cut = 1;
  80.             
  81.             # do cutscene stuff
  82.             StartCutscene(0);
  83.             SetActorFlags(player, 0x200000);
  84.             
  85.             # add some thrust to player
  86.             SetThingThrust(player, '0.0 -0.75 0.0');
  87.             
  88.             # switch to horus_Cam1
  89.             SetCameraFocus(2, horus_Cam1);
  90.             SetCameraSecondaryFocus(2, player);
  91.             SetCurrentCamera(2);
  92.             SetCameraFOV(90, 0, 0.0);
  93.             
  94.             Call openDoors;
  95.         }
  96.         
  97.         if((sender == inside) && (done == 0))
  98.         {
  99.             
  100.             done = 1;
  101.             in_Cut = 0;
  102.             
  103.             # Reset the camera
  104.             SetCameraPosition(1, GetThingPos(horus_Cam1));
  105.             SetCurrentCamera(1);
  106.             
  107.             StopThing(player);
  108.             ClearActorFlags(player, 0x200000);
  109.             EndCutscene();
  110.             
  111.             # tell chaseLower we're go
  112.             SendMessage(cog_ChaseLower, user2);
  113.         }
  114.         
  115.         if((sender == openInside) && (done == 1) && (doorsOpen == 0))
  116.         {
  117.             Call openDoors;
  118.         }
  119.         
  120.         if((sender == openInside) && (in_Cut == 1) && (done == 0))
  121.         {
  122.             Call closeDoors;
  123.         } 
  124.     
  125.         if((sender == close) && (doorsOpen == 1))
  126.         {
  127.             Call closeDoors;
  128.             done = 0;
  129.         }
  130.     }
  131.         
  132.         return;
  133.         
  134. # ========================================================================================
  135.  
  136. activated:
  137.  
  138.     player = GetLocalPlayerThing();
  139.  
  140.     while (newComment == oldComment) 
  141.     {
  142.         newComment = RandBetween(0, 1);
  143.     }
  144.     
  145.     oldComment = newComment;
  146.     
  147.     count = count + 1;
  148.     
  149.     if((GetSenderRef() == doorL) || (GetSenderRef() == doorR))
  150.     {
  151.         if(playing == 0)
  152.         {
  153.             playing = 1;
  154.             Call doorLine;
  155.         }
  156.     }
  157.  
  158.     return;
  159.  
  160. # ========================================================================================
  161.  
  162. openDoors:
  163.  
  164.     doorsMoving = 1;
  165.     doorsOpen = 1;
  166.     SetCollideType(doorL, 0);
  167.     SetCollideType(doorR, 0);
  168.     
  169.     SectorAdjoins(doorSector, 1);
  170.     PlaySoundThing(sndOpen, doorR, 0.75, 10.0, 20.0, 0);
  171.     Sleep(0.01);
  172.     PlaySoundThing(sndOpen, doorL, 0.75, 10.0, 20.0, 0);
  173.     MoveToFrame(doorL, 1, 2.0);
  174.     MoveToFrame(doorR, 1, 2.0);
  175.     WaitForStop(doorL);
  176.     doorsMoving = 0;
  177.             
  178.     return;
  179.  
  180. # ========================================================================================
  181.  
  182. closeDoors:
  183.  
  184.     doorsMoving = 1;
  185.     PlaySoundThing(sndClose, doorR, 0.75, 10.0, 20.0, 0);
  186.     Sleep(0.01);
  187.     PlaySoundThing(sndClose, doorL, 0.75, 10.0, 20.0, 0);
  188.     MoveToFrame(doorL, 0, 1.6);
  189.     MoveToFrame(doorR, 0, 1.6);
  190.     WaitForStop(doorL);
  191.     SectorAdjoins(doorSector, 0);
  192.     
  193.     SetCollideType(doorL, 3);
  194.     SetCollideType(doorR, 3);
  195.     
  196.     doorsOpen = 0;
  197.     doorsMoving = 0;
  198.  
  199.     return;
  200.     
  201. # ========================================================================================
  202.  
  203. doorLine:
  204.  
  205.     # do cutscene stuff
  206.     MakeMeStop();
  207.     StartCutscene(0);
  208.     
  209.     # offset camera and nudge the door
  210.     SetExtCamOffset('0.1 0.0 0.065');
  211.     
  212.     # put away any weapon
  213.     DeselectWeaponWait(player);
  214.     
  215.     PlayMode(player, 60, 0);
  216.     Sleep(0.3);
  217.     
  218.     # player never activated door in PYR
  219.     if(global12 == 0)
  220.     {
  221.         PlayVoice(player, fireSafety, 1.0, 1);
  222.         global12 = 1;
  223.     }
  224.     
  225.     # player activated door in PYR
  226.     else if(global12 == 1)
  227.     {
  228.         if(count == 5)
  229.         {
  230.             count = 0;
  231.             PlayVoice(player, fireSafety, 1.0, 1);
  232.         }
  233.         
  234.         else
  235.         {
  236.             PlayVoice(player, in_Line0[newComment], 1.0, 1);
  237.         }
  238.     }
  239.     
  240.     RestoreExtCam();
  241.     ClearActorFlags(player, 0x200000);
  242.     EndCutscene();
  243.     
  244.     playing = 0;
  245.     
  246.     return;
  247.     
  248. # ========================================================================================
  249.  
  250. blocked:
  251.  
  252.     Print("blocked");
  253.     Call openDoors;
  254.     return;
  255.     
  256. # ========================================================================================
  257.  
  258. end
  259.  
  260.